package servlet.redirect;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class RedirectServlet
 */
public class RedirectServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
  
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request,response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		/*
		 * 리다이렉트 방식으로 수행이동
		 * 요청받은 서블릿이 다른 웹컴포넌트(servlet/jsp/html)로 수행을 이동하도록
		 * client 웹브라우저에게 응답.(웹 브라우저가 다른 url로 요청하도록 처리)
		 * 
		 * response.status(301);
		 * response.Header("location", "/myservlet/redirct/response.html");
		 * ->
		 * response.sendRedirect("url");
		 */
		
		response.sendRedirect("/myservlet/redirect/response.html");
		
	}

}
